package com.ciwong.epaper.modules.pad.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.widget.TextView;

import com.ciwong.epaper.R;


/**
 * Created by Administrator on 2017/7/12.
 */
public class PadSuccessActivity extends Activity {



//    private ViewGroup mContentView;
    private TextView mTvTime;

    @Override
    public void onCreate(Bundle savedInstanceState ) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_pad_success_dialog);
        setFinishOnTouchOutside(false);
        initView();
        timer.start();
    }



//    public CWSuccessDialog(@NonNull Context context, @StyleRes int themeResId) {
//        super(context, themeResId);
//        mContentView = (ViewGroup) LayoutInflater.from(context)
//                .inflate(R.layout.layout_pad_success_dialog, null);
//        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//        super.setContentView(mContentView);
//        getWindow().setSoftInputMode (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
//        initView();
//        initEvent();
//        timer.start();
//    }



    private CountDownTimer timer = new CountDownTimer(3000, 1000) {
        @Override
        public void onTick(long millisUntilFinished) {
            mTvTime.setText((millisUntilFinished / 1000) + "秒后为您返回首页");

        }
        @Override
        public void onFinish() {

            mTvTime.setText(  "0秒后为您返回首页");
          /*  Intent intent = new Intent(PadSuccessActivity.this, NewLoginActivity.class);
            startActivity(intent);
            finish();*/
            setResult(RESULT_OK);
            finish();
        }
    };
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        setResult(RESULT_OK);
        finish();
    }



    private void initView() {
        mTvTime = (TextView) findViewById(R.id.tv_time);

    }
}
